#define _CRT_SECURE_NO_WARNINGS
#include <iostream>
#include <unordered_map>

using namespace std;

bool CheckPermutation(string s1, string s2) {
    if (s1.size() != s2.size())
        return false;

    unordered_map<char, int> hash;

    for (auto c : s1)
    {
        hash[c]++;
    }

    for (auto c : s2)
    {
        if (hash[c] <= 0)
        {
            return false;
        }

        hash[c] -= 1;
    }

    return true;
}

int main()
{
    CheckPermutation("abb", "aab");
	return 0;
}